package com.company;

public class Main {

    public static void main(String[] args) {
        // write your code here
        SingletonPatternDemo.SingleObject teacher = SingletonPatternDemo.SingleObject.getInstance();
        SingletonPatternDemo.SingleObject teacher1 = SingletonPatternDemo.SingleObject.getInstance();
        //显示消息
        if (teacher == teacher1){
            System.out.println("teacher 与 teacher1是同一个实例");
            teacher.showMessage();
        }
        else{
            System.out.println("teacher 与 teacher1不是同一个实例");
        }
    }
}
